package com.willian.andrappfw.utils;

import android.view.View;

import java.util.HashMap;


public abstract class OnClickedListener implements View.OnClickListener {
    private final long MIN_CLICK_GAP = 1000L;
    private final HashMap<View, Long> lastClickTime = new HashMap();

    public OnClickedListener() {
    }

    public void onClick(View v) {
        long clickTime = System.currentTimeMillis();
        Long lastTime = (Long)this.lastClickTime.get(v);
        if (lastTime == null || clickTime - lastTime > 1000L) {
            this.lastClickTime.put(v, clickTime);
            this.onClicked(v);
        }

    }

    public abstract void onClicked(View var1);
}
